<template>
  <van-popup v-model="showBit" @close="close()">
    <div class="dailyAttendance">
      <div class="dailyAttendanceClose" @click="close()">
        <img src="@/assets/images/ic_shut.png" alt="">
      </div>
      <p class="title">每日签到</p>
      <p class="tip1" v-html="checkin_info">
        <!--抱歉！您下午已签到！ <br>-->
        <!--晚上还有1次签到机会哦~<br>-->
        <!--本次您可获得：0工分 <br>-->
        <!--上次签到时间：2019-05-20 14：23:23<br>-->
        <!--已连续签到：1天<br>-->
        <!--累计总签到：23天<br>-->
        <!--当前总工分：1023工分<br>-->
        <!--当前未完成任务数：无<br>-->
      </p>
      <!--<p class="tip2">快前往赚取更多工分吧~</p>-->
    </div>
  </van-popup>
</template>

<script>
  /**
   *
   * @Author zzl
   * @Date 2019/6/3 10:41.
   */
  import utils from '../../../lib/StringExtend';
  import {Indicator} from 'mint-ui';

  export default {
    mounted() {

    },
    components: {},
    props: {
      show: {
        required: true
      },
    },
    data() {
      return {
        wechatId: utils.getCookie('wechat_id'),
        checkin_info: undefined,
        showBit: this.show
      }
    },
    computed: {},
    methods: {
      close() {
        this.$emit('dailyAttendanceClose', false)
      },
      loadData(url) {
        let params = {
          open_id: utils.getCookie('open_id_' + this.wechatId)
        };
        Indicator.open('加载中...');
        this.$axios.userDefined(url, params).then(res => {
          Indicator.close();
          if (res.errcode !== '000') {
            this.$toast(res.errmsg);
            return;
          }
          var regR = /\r/g;
          var regN = /\n/g;
          this.checkin_info = res.data.checkin_info.replace(regR, "<br>").replace(regN, '').replace(/<br><br>/g, '<br>');
          this.showBit = true;
        });
      }
    },
    watch: {
      show(val) {
        this.showBit = val;
      },
      showBit(val) {
        this.$emit('dailyAttendanceClose', val)
      },
    },
    filters: {},
    beforeDestroy() {

    }
  }
</script>

<style lang="less" scoped>
  .dailyAttendance {
    width: 6.5rem;
    height: 6.06rem;
    position: relative;

    .dailyAttendanceClose {
      position: absolute;
      width: 0.24rem;
      height: 0.24rem;
      top: 0.24rem;
      right: 0.24rem;

      img {
        width: 100%;
        height: 100%;
      }
    }

    .title {
      color: #333333;
      font-size: 0.4rem;
      padding-top: 0.62rem;
      margin-bottom: 0.4rem;
      box-sizing: border-box;
      letter-spacing: 0.08rem;
      font-weight: initial;
      text-align: center;
    }

    .tip1 {
      font-weight: initial;
      padding: 0 0.37rem 0 0.45rem;
      box-sizing: border-box;
      color: #999999;
      letter-spacing: 0.02rem;
      font-size: 0.3rem;
      line-height: 0.42rem;
    }

    .tip2 {
      position: absolute;
      bottom: 0.23rem;
      width: 100%;
      text-align: center;
      color: #999999;
      font-size: 0.24rem;
      letter-spacing: 0.02rem;
    }
  }
</style>
